<div class="weui-gallery" style="display: none;position: absolute" id="{{$name}}">
    <span class="weui-gallery__img {{$name}}-img"></span>
    <span class="weui-icon-cancel {{$name}}-close" style="color: white;top: 20px;right: 10px;position: absolute;"></span>
</div>
<script>
    $(function () {
        $('{{$elem}}').on('click',function () {
            var img = '';
            if($(this).is('img')){
                img = $(this).attr('src');
            }else{
                img = $(this).attr('data-img');
            }
            if(img){
                $('.{{$name}}-img').attr('style','background-image:url("'+img+'")');
                $('#{{$name}}').show(300);
            }
        })
        $('.{{$name}}-close').on('click',function () {
            $('#{{$name}}').hide(300);
        })
    })

</script>